<?php require_once '../global.php';


//删除留言
function king_ajax_delete(){
	global $king;
	$king->access('bbsgl_delete');
	$list=kc_getlist();
	$king->db->query("delete from %s_pinglun where kid in ($list)");
	kc_ajax('OK',"<p class=\"k_ok\">".$king->lang->get('system/ok/delete')."</p>",1);
}


/**
菜单调用
*/
function inc_menu(){
	global $king;
	$left=array(
		'edt'=>array(
			'href'=>'javascript:;',
			'ico'=>'c2',
			'title'=>'添加匹配模式',
			'rel'=>"{CMD:'edt',METHOD:'GET',URL:'./manage.php'}",
			'class'=>"k_ajax",
		),
		'2'=>array(
			'href'=>'pl.php',
			'ico'=>'p7',
			'title'=>'评论',
			),
		'3'=>array(
			'href'=>'manage.php',
			'ico'=>'p7',
			'title'=>'匹配模式',
			),

	);
	if(isset($_GET['kid'])){
		$left['view']=array(
			'href'=>'manage.php?action=view&kid='.$_GET['kid'],
			'ico'=>'p8',
			'title'=>$king->lang->get('system/common/view'),
		);
	}
	return array($left,array());
}

function king_def(){
	global $king;
	$king->access('bbsgl');

	$_cmd=array(
		'delete'=>$king->lang->get('system/common/del'),
	);

	$manage="'<i><a href=\"/browse/home/bar_thread_'+K[0]+'_1.htm\">'+\$.kc_icon('h7','".addslashes($king->lang->get('system/common/brow'))."')+'</a></i>'";
	$_js=array(
		"\$.kc_list(K[0],K[0],'manage.php?action=view&kid='+K[0])",
		"'<i>'+K[1]+'</i>'",
		"'<i>'+K[2]+'</i>'",
		"''+K[3]+''",

	
	);
	$s=$king->openList($_cmd,'',$_js,$king->db->pagelist('pl.php?pid=PID&rn=RN',$king->db->getRows_number('%s_pinglun')));

	$_sql="select kid,nameid,nshow,kcontent from %s_pinglun order by kid desc";
	if(!$res=$king->db->getRows($_sql,1))
		$res=array();


	$s.="ll('".$king->lang->get('bbsgl/list/title')."',
		'<i>".$king->lang->get('bbsgl/list/chakan')."</i>',
				'<i>".$king->lang->get('bbsgl/list/chakan')."</i>',
	    '<i>".$king->lang->get('bbsgl/list/date')."</i>',1);";


	foreach($res as $rs){
		$s.="ll({$rs['kid']},
			   '".$rs['nameid']."',
			    '".$rs['nshow']."',
				    '".mb_substr($rs['kcontent'],0,30,'utf-8')."',0);";

	}

	$s.=$king->closeList();

	list($left,$right)=inc_menu();
	$king->skin->output($king->lang->get('bbsgl/title/center'),$left,$right,$s);
}




?>